package com.dcrzl.gazgmh.module.mh.controller;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.dcrzl.gazgmh.common.annotation.SysLog;
import com.dcrzl.gazgmh.common.entity.mh.MhIndexModule;
import com.dcrzl.gazgmh.common.utils.PageInfo;
import com.dcrzl.gazgmh.common.utils.Result;
import com.dcrzl.gazgmh.module.mh.service.MhIndexModuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 
 *
 * @author dcrzl
 * @email 1728795786@qq.com
 * @date 2024-11-24 15:50:54
 */
@RestController
@RequestMapping("/mh/index/module")
public class MhIndexModuleController {
    @Autowired
    private MhIndexModuleService mhIndexModuleService;

    /**
     * 列表
     */
    @GetMapping("/list")
    public Result<List<MhIndexModule>> list(MhIndexModule mhIndexModule){
       return mhIndexModuleService.selectUList(mhIndexModule);
    }

    /**
    * 列表分页
    */
    @GetMapping("/page")
    public PageInfo<MhIndexModule> page(MhIndexModule mhIndexModule){
        return mhIndexModuleService.selectUPage(mhIndexModule);
    }

    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    public Result<MhIndexModule> info(@PathVariable("id") Long id){
		return mhIndexModuleService.selectById(id);
    }


    /**
     * 保存
     */
    @SysLog("新增首页模块")
    @PostMapping("/save")
    public Result<Integer> save(@RequestBody MhIndexModule mhIndexModule){
		return mhIndexModuleService.insert(mhIndexModule);
    }

    /**
     * 修改
     */
    @SysLog("修改首页模块")
    @PutMapping("/update")
    public Result<Integer> update(@RequestBody MhIndexModule mhIndexModule){
		return mhIndexModuleService.updateById(mhIndexModule);
    }

    /**
     * 删除
     */
    @SysLog("删除首页模块")
    @DeleteMapping("/delete")
    public Result<Integer> delete(@RequestBody Long[] ids){
        return mhIndexModuleService.deleteBatchIds(Arrays.asList(ids));
    }

}
